/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 1e5 + 2;

std::vector<int> bit[maxn];

int cnt[maxn * 2];

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
      int k;
      cin >> k;
      for (int j = 1; j <= k; ++j) {
        int tmp;
        cin >> tmp;
        bit[i].push_back(tmp);
        cnt[tmp]++;
      }
    }
    bool ans = false;
    for (int i = 1; i <= n; ++i) {
      bool flag = true;
      for (auto j : bit[i]) {
        if (!(cnt[j] > 1)) {
          flag = false;
        }
      }
      ans |= flag;
    }
    for (int i = 1; i <= n; ++i) {
      for (auto j : bit[i]) {
        cnt[j]--;
      }
      bit[i].clear();
      bit[i].shrink_to_fit();
    }
    cout << (ans ? "YES\n" : "NO\n");
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("B. Gardener and the Array.in", "r", stdin);
  freopen("B. Gardener and the Array.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
